package serviceimpl;

import entity.Product;
import mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.ProductService;

import java.util.List;


@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;

    /*首页根据类型得到前三个商品*/
    public List<Product> selectByTypeThree(String type){

        return productMapper.selectByType(type).subList(0,3);
    }

    public List<Product> selectByType(String type){
        return productMapper.selectByType(type);
    }


    public List<String> getAllType(){
        return productMapper.getAllType();
    }

    public List<Product> getAllProduct(){
        return productMapper.getAllProduct();
    }


}
